package org.blackjuly.sign.service;

import org.blackjuly.sign.data.DataBean;
import org.blackjuly.sign.data.DataTrimmer;
import org.blackjuly.sign.entity.Grade;

public class GradeService extends BaseService{
	/**
	 * 获取成绩
	 * student 主键值
	 * id 主键名
	 */
	public Grade findGradeByStudent(String student,String id) throws Exception {
		DataBean<Grade> dataBean = new DataBean<>(conn, "subject", id);
		dataBean.setEntityClass(Grade.class);
		return dataBean.doSelect(student);
	}
	/**
	 * 查找最大的id
	 */
	public Long findBestId(String from) throws Exception {
		String sql = "select max(id) as maxid from " + from;
		DataTrimmer dt = new DataTrimmer(conn);
		return (Long)dt.selectOne(sql).get("maxid");
	}
}